package com.agile.familytree.util;

import java.util.HashMap;

public class FamilyUtil {

	private static volatile FamilyUtil familyUtil = null;
	private HashMap<String, String> hIdName = new HashMap<String, String>();
	private HashMap<String, Boolean> hIdAlive = new HashMap<String, Boolean>();
	private HashMap<String, String> hIdDeathDate = new HashMap<String, String>();
	
	private FamilyUtil() {
	}

	public static FamilyUtil getInstance() {

		if (familyUtil == null) {
			synchronized (FamilyUtil.class) {
				if (familyUtil == null) {
					familyUtil = new FamilyUtil();
				}
			}
		}
		return familyUtil;
	}
	
	protected static void demoMethod( ) {
	    System.out.println("demoMethod for singleton"); 
	}
	
	public void populateIdName(String Id, String name){
		hIdName.put(Id, name);
	}
	
	public HashMap<String, String> getHashIdName(){
		return hIdName;
	}
	
	public void populateIdAlive(String Id, String DeathDate){
		
		if(DeathDate!= null && DeathDate.length()>0)
			hIdAlive.put(Id, false);
		else
			hIdAlive.put(Id, true);
		
		hIdDeathDate.put(Id, DeathDate);
		
	}
	
	public HashMap<String, Boolean> getHashIdAlive(){
		return hIdAlive;
	}
	
	//public void populateIdDeathDate(String Id, String DeathDate){
	//	hIdDeathDate.put(Id, DeathDate);
	//}
	
	public HashMap<String, String> getHashIdDeathDate(){
		return hIdDeathDate;
	}


}


